<%@ Page Language="C#" Theme="Defaultsys" AutoEventWireup="true" CodeFile="Role.aspx.cs"
    Inherits="Role" Title="Rapport Plan System - Role" MasterPageFile="~/MasterPage.master" %>

<%@ MasterType VirtualPath="~/MasterPage.master" %>
<asp:Content runat="server" ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1">

    <script language="javascript" type="text/javascript">	
        
        function ValidateCheckBoxs(oSrc, args)
        {
            args.IsValid = false;
            var objSteluta = document.getElementById('ctl00_ContentPlaceHolder1_lblSteluta');
            if (objSteluta!=null){
                    objSteluta.style.visibility = "hidden";
                }
            var objGroupExists = document.getElementById('ctl00_ContentPlaceHolder1_lblGrupExist');
            if (objGroupExists!=null){
                    objGroupExists.style.visibility = "hidden";
                }
            var obj1 = document.getElementById('ctl00_ContentPlaceHolder1_ckViewContact');                 
            var obj2 = document.getElementById('ctl00_ContentPlaceHolder1_ckEditContact');
            var obj3 = document.getElementById('ctl00_ContentPlaceHolder1_ckViewContactGroup');
            var obj4 = document.getElementById('ctl00_ContentPlaceHolder1_ckEditContactGroup');
            var obj5 = document.getElementById('ctl00_ContentPlaceHolder1_ckViewLetterTemplate');
            var obj6 = document.getElementById('ctl00_ContentPlaceHolder1_ckEditLetterTemplate');            
            var obj10 = document.getElementById('ctl00_ContentPlaceHolder1_ckEditUserGroup');
            var obj12= document.getElementById('ctl00_ContentPlaceHolder1_ckViewAvailableToCallUsers');
            var obj13 = document.getElementById('ctl00_ContentPlaceHolder1_ckAssignCall');
            var obj14 = document.getElementById('ctl00_ContentPlaceHolder1_ckSetNumberOfCallsPerWeek');            
            var obj15 = document.getElementById('ctl00_ContentPlaceHolder1_ckViewBusinessRules');
            var obj16 = document.getElementById('ctl00_ContentPlaceHolder1_ckEditBusinesRule');
            var obj17 = document.getElementById('ctl00_ContentPlaceHolder1_ckConfigureCallFinishedPage');             
            var obj18 = document.getElementById('ctl00_ContentPlaceHolder1_ckSummaryReport'); 
            var obj19 = document.getElementById('ctl00_ContentPlaceHolder1_ckAssignLetters'); 
            var obj20 = document.getElementById('ctl00_ContentPlaceHolder1_ckConfigureContactInterface'); 
            var obj21 = document.getElementById('ctl00_ContentPlaceHolder1_ckEditContactType');             
            var obj22 = document.getElementById('ctl00_ContentPlaceHolder1_ckEditUser');            
            var obj23 = document.getElementById('ctl00_ContentPlaceHolder1_ckUserLog');            
            var obj24 = document.getElementById('ctl00_ContentPlaceHolder1_ckWelcomeTemplate');            
            
                                                        
            if ( (obj1.checked == true) || (obj2.checked == true) || (obj3.checked == true) || (obj4.checked == true) || (obj5.checked == true) ||
                 (obj6.checked == true))
                args.IsValid = true;         
            if ( (obj10.checked == true) || (obj12.checked == true) || (obj13.checked == true) || (obj14.checked == true) || 
                 (obj15.checked == true) || (obj16.checked == true) || (obj17.checked == true) || (obj18.checked == true) )
                args.IsValid = true;    
            if ( (obj19.checked == true) || (obj20.checked == true) || 
                 (obj21.checked == true) || (obj22.checked == true) || (obj23.checked == true)  || (obj24.checked == true))
                args.IsValid = true;                
        }
		
    </script>

    <table border="0" width="100%" cellpadding="0" cellspacing="0">
        <tr>
            <td class="contTable">
                <table>
                    <tr>
                        <td>
                            Group name:</td>
                        <td style="width: 199px">
                            <asp:TextBox ID="txtName" runat="server" Width="226px" MaxLength="255"></asp:TextBox>
                        </td>
                        <td>
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtName"
                                CssClass="error" Display="Dynamic" SetFocusOnError="True" ErrorMessage="*"></asp:RequiredFieldValidator>
                            <asp:Label ID="lblSteluta" runat="server" ForeColor="Red" Text="*" Width="12px"></asp:Label>
                        </td>
                    </tr>
                    <tr>
                        <td valign="top">
                            Privileges:</td>
                        <td style="width: 199px">
                            <asp:CheckBox ID="ckViewContact" runat="server" Text="view contact" />
                            <br />
                            <asp:CheckBox ID="ckEditContact" runat="server" Text="edit contact" />
                            <br />
                            <asp:CheckBox ID="ckViewContactGroup" runat="server" Text="view contact group" />
                            <br />
                            <asp:CheckBox ID="ckEditContactGroup" runat="server" Text="edit contact group" /><br />
                            <asp:CheckBox ID="ckViewLetterTemplate" runat="server" Text="view template" /><br />
                            <asp:CheckBox ID="ckEditLetterTemplate" runat="server" Text="edit template" /><br />
                            <asp:CheckBox ID="ckViewAvailableToCallUsers" runat="server" Text="view available to call users" /><br />
                            <asp:CheckBox ID="ckAssignCall" runat="server" Text="assign call" /><br />
                            <asp:CheckBox ID="ckSetNumberOfCallsPerWeek" runat="server" Text="set number of calls per week" /><br />
                            <asp:CheckBox ID="ckViewBusinessRules" runat="server" Text="view business rules" /><br />
                            <asp:CheckBox ID="ckEditBusinesRule" runat="server" Text="edit business rule" /><br />
                            <asp:CheckBox ID="ckConfigureCallFinishedPage" runat="server" Text="configure call finished page" /><br />
                            <asp:CheckBox ID="ckSummaryReport" runat="server" Text="summary report" /><br />
                            <asp:CheckBox ID="ckAssignLetters" runat="server" Text="assign letters" /><br />
                            <asp:CheckBox ID="ckConfigureContactInterface" runat="server" Text="configure contact interface" /><br />
                            <asp:CheckBox ID="ckEditContactType" runat="server" Text="edit contact type" /><br />
                            <asp:CheckBox ID="ckEditUser" runat="server" Text="edit user" /><br />
                            <asp:CheckBox ID="ckEditUserGroup" runat="server" Text="edit user group" />&nbsp;
                            <br />
                            <asp:CheckBox ID="ckUserLog" runat="server" Text="view user log" /><br />
                            <asp:CheckBox ID="ckWelcomeTemplate" runat="server" Text="set welcome template" /><br />
                            <asp:CheckBox ID="ckMailSettings" runat="server" Text="mail settings" /></td>
                        <td style="vertical-align: top">
                            <asp:CustomValidator ID="CustomValidator1" runat="server" ClientValidationFunction="ValidateCheckBoxs"
                                CssClass="ValidationMessage" ErrorMessage="*" Display="Dynamic" SetFocusOnError="True"></asp:CustomValidator>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="3">
                            <asp:Button ID="btnSave" runat="server" Text="Save" OnClick="Save" />
                            <asp:Button ID="btnCancel" runat="server" Text="Cancel" OnClick="Cancel" CausesValidation="false" />
                            <br />
                            <asp:Label ID="lblSavedRole" runat="server" ForeColor="#FF8000" Text="The role was saved successfully"
                                Visible="False"></asp:Label></td>
                    </tr>
                    <tr>
                        <td colspan="3">
                            <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtName"
                                CssClass="error" Display="Dynamic" SetFocusOnError="True" ErrorMessage="(*)Group name is required"></asp:RequiredFieldValidator>
                            <asp:Label ID="lblGrupExist" runat="server" ForeColor="Red" Text="(*)A group with the same name already exists!"
                                Width="310px"></asp:Label></td>
                    </tr>
                    <tr>
                        <td colspan="3">
                            <asp:CustomValidator ID="CustomValidator17" runat="server" ClientValidationFunction="ValidateCheckBoxs"
                                CssClass="ValidationMessage" ErrorMessage="(*)You must select at least one privilege"
                                SetFocusOnError="True" Display="Dynamic"></asp:CustomValidator>
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
</asp:Content>
